﻿using KernelSyntaxExample.Utils;
using Microsoft.SemanticKernel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SemanticKernelBlazorDemo.Shared.Services;

public class SelectKeyService: ISelectKeyService
{
    private IKernel _kernel;

    public SelectKeyService(IKernelFactory kernelFactory)
    {
        _kernel = kernelFactory.Produce();
    }

    public string SelectKeyAsync(string ask)
    {
        var keyAnalysisSkill =
               _kernel.ImportSemanticSkillFromDirectory(
                   ProjectFile.GetSkillsFolder(), "KeyAnalysisSkill");
        return _kernel.RunAsync(ask, keyAnalysisSkill["SelectKeys"]).Result.ToString();
    }

}
